﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Events.aspx.cs" Inherits="Dune.Web.Events" %>
<%@ Register TagPrefix="ctrl" TagName="CalendarMenu" Src="~/Controls/Menu/CalendarMenu.ascx" %>
<asp:Content id="mainContent" runat="server" ContentPlaceHolderID="content">
<div class="menu">&nbsp;</div>
<script type="text/javascript">
    function AddNews() {
        $('#AddNews').show("slow");
    };

    function CancelNewsClick() {
        $('#AddNews').hide("slow");
        $('#txtNewsHeader').val("");
        $('#txtNewsContent').val("");
    };

    function AddNewsClick() {
        $('#content').html("&nbsp;");
        url = 'AjaxHtmlContent.aspx?Content=AddNews';
        $('#content').load(url, {
            header: $('#txtNewsHeader').val(),
            text: $('#txtNewsContent').val()
        }, function() {
            CancelNewsClick();
            GetHTML();
        });
    };
    function GetHTML() {
        $('#content').html("&nbsp;");
        url = 'AjaxHtmlContent.aspx?Content=News';
        $('#content').load(url);
    };

    $(document).ready(function() {
        GetHTML();
    });
</script>
<table width="100%" cellpadding="0" cellspacing ="0">
    <tr>
        <td  valign="top">
            <div class="rounded">
                <div id="loader" style="display:none;"><img src="img/ajax-loader.gif"/></div>           
                <div id="content">
                </div>
            </div>
        </td>
         <td valign="top" style="width:220px">
            <ctrl:CalendarMenu runat="server" id="cmMenu"></ctrl:CalendarMenu>   
            <div class="rounded">
                <input type="button" id="btnAddnews" value="Добавить новость" onclick="AddNews();" />
                <div id="AddNews" class="none">
                    Заголовок:<br />
                    <input type="text" id="txtNewsHeader" /><br />
                    Содержание:<br />
                    <textarea id="txtNewsContent"></textarea><br />
                    <input type="button" id="btnAdd" value="Сохранить" onclick="AddNewsClick();" />
                <input type="button" id="btnCancel" value="Отменить" onclick="CancelNewsClick();" />
                </div>
            </div>         
        </td>
    </tr></table>
</asp:Content>
